package com.example.venadaoa.tool;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.example.venadaoa.R;

public class ToastHelp {
	public static void doToast(Context context, int stringId) {
        doToast(context, stringId, false);
    }

    public static void doToast(Context context, String content) {
    	doToastInTop(context, content);
    }
    
    public static void doToastInTop(Context context, String content) 
    {
    	LayoutInflater inflater = LayoutInflater.from(context);
    	   View layout = inflater.inflate(R.layout.toast_top_view,
    	     null);
    	   TextView title = (TextView) layout.findViewById(R.id.error_message);
    	   title.setText(content);
    	   Toast toast = new Toast(context);
    	   toast.setGravity(Gravity.CENTER, 0, 0);
    	   toast.setDuration(Toast.LENGTH_SHORT);
    	   toast.setView(layout);
    	   toast.show();
    	
    }

    public static void doToast(Context context, String content, boolean longOrShort) {
        Toast.makeText(context, content, longOrShort ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show();
    }

    public static void doToast(Context context, int stringId, boolean longOrShort) {
        Toast.makeText(context, stringId, longOrShort ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show();
    }
}
